package co.fitstart.entity.market.template;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.demo2do.core.format.PersistentFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import co.fitstart.entity.courseware.movement.Movement;

/**
 * 每日家庭作业
 * 
 * @author dan
 *
 */
@Entity
@Table(name = "market_courseware_template")
@PersistentFormat
@JsonIgnoreProperties(value={"hibernate_lazy_initializer","handler","fieldHandler"})
public class MarketCoursewareTemplate {
    
    @Id
    @GeneratedValue
    private Long id;
    
    /** 名称 */
    private String name;
    
    /** 运动量 */
    private String actDescription;
    
    /** 动作 */
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    @PersistentFormat
    private Movement movement;
    
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private MarketDailyCoursewareTemplate daily;
    
    @Column(name = "is_disabled")
    private boolean disabled;
   
    /**
     * The default constructor
     */
    public MarketCoursewareTemplate() {
        
    }
    
    /**
     * 
     * @param daily
     * @return
     */
    public MarketCoursewareTemplate initilization(MarketDailyCoursewareTemplate daily) {
        this.name = this.movement.getName();
        this.daily = daily;
        this.disabled = false;
        return this;
    }
    
    /**
     * 
     * @return
     */
    public MarketCoursewareTemplate disable() {
        this.disabled = true;
        return this;
    }

    /**
     * @return the id
     */
    public Long getId() {
        return id;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @return the actDescription
     */
    public String getActDescription() {
        return actDescription;
    }

    /**
     * @return the movement
     */
    public Movement getMovement() {
        return movement;
    }

    /**
     * @return the daily
     */
    public MarketDailyCoursewareTemplate getDaily() {
        return daily;
    }

    /**
     * @return the disabled
     */
    public boolean isDisabled() {
        return disabled;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @param actDescription the actDescription to set
     */
    public void setActDescription(String actDescription) {
        this.actDescription = actDescription;
    }

    /**
     * @param movement the movement to set
     */
    public void setMovement(Movement movement) {
        this.movement = movement;
    }

    /**
     * @param daily the daily to set
     */
    public void setDaily(MarketDailyCoursewareTemplate daily) {
        this.daily = daily;
    }

    /**
     * @param disabled the disabled to set
     */
    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }

}
